<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "后台管理中心-接口日志新">
</@frame.head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/search_table.css" />
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span> 日志管理新 <span class="c-gray en">&gt;</span> 接口日志新 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <form id="query_cbd_log_form" method="post" href="${contextPath}/cbd_log/query_list">
        <input type="hidden" name="pageNo" value="${pagination.pageNo}"  id="pageNo" />
        <div class="text-c">
            <table class="table search_table">
                <tr>
                    <td>会员卡号：</td>
                    <td>
                        <input id="memberNo" class="input-text  radius" placeholder="会员卡号" name="memberNo" type="text" value="${cbdSendLogQo.memberNo }"/>
                    </td>
                    <td>会员TOKEN：</td>
                    <td>
                        <input id="token" class="input-text  radius"  placeholder="会员TOKEN" name="token" type="text" class="text" value="${cbdSendLogQo.token }"/>
                    </td>
                    <td>返回结果：</td>
                    <td>
                        <span class="select-box radius">
                        <select class="select" name="state">
                            <option value="">查询所有</option>
                            <option value="1" <#if cbdSendLogQo.state == 1>selected="selected"</#if>>成功</option>
                            <option value="0" <#if cbdSendLogQo.state == 0>selected="selected"</#if>>失败</option>
                        </select>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td>接口名称：</td>
                    <td>
                        <span class="select-box radius">
                        <select class="select" name="interfaceName">
                            <option value="">查询所有</option>
                            <option value="queryMemberForSKBByToken" <#if cbdSendLogQo.interfaceName == 'queryMemberForSKBByToken'>selected="selected"</#if>>会员登录token</option>
                            <option value="queryMemberInfoForSKB" <#if cbdSendLogQo.interfaceName == 'queryMemberInfoForSKB'>selected="selected"</#if>>会员信息</option>
                            <option value="sendVerificationCode" <#if cbdSendLogQo.interfaceName == 'sendVerificationCode'>selected="selected"</#if>>发送验证码</option>
                            <option value="queryBindInfo" <#if cbdSendLogQo.interfaceName == 'queryBindInfo'>selected="selected"</#if>>会员认证信息</option>
                            <option value="exchangeForSKB" <#if cbdSendLogQo.interfaceName == 'exchangeForSKB'>selected="selected"</#if>>里程扣减</option>
                            <option value="orderStatusQueryForSKB" <#if cbdSendLogQo.interfaceName == 'orderStatusQueryForSKB'>selected="selected"</#if>>订单状态校验</option>
                            <option value="checkVerificationCode" <#if cbdSendLogQo.interfaceName == 'checkVerificationCode'>selected="selected"</#if>>验证码校验</option>
                            <option value="cancleExchangeForSKB" <#if cbdSendLogQo.interfaceName == 'cancleExchangeForSKB'>selected="selected"</#if>>里程退还</option>
                            <option value="sendSMSBySKB" <#if cbdSendLogQo.interfaceName == 'sendSMSBySKB'>selected="selected"</#if>>电子码短信</option>
                            <option value="queryRedemptionQueryInfo" <#if cbdSendLogQo.interfaceName == 'queryRedemptionQueryInfo'>selected="selected"</#if>>兑换信息查询</option>
                        </select>
                        </span>
                    </td>
                    <td>日期范围：</td>
                    <td style="padding: 0px;">
                      <table style="width: 100%;margin: 0px;padding: 0px;">
                      	<tr>
                      		<td style="width: 48%;">
                      		  <input type="text" <#if cbdSendLogQo.beginDate??>value="${cbdSendLogQo.beginDate?string('yyyy-MM-dd')}"</#if> onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}',readOnly : true })" id="datemin" name="beginDate" class="input-text Wdate">
                      		</td>
                      		<td style="width: 4%;">至</td>
                      		<td style="width: 48%;">
                      		  <input type="text" <#if cbdSendLogQo.endDate??>value="${cbdSendLogQo.endDate?string('yyyy-MM-dd')}"</#if> onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' ,readOnly : true})" id="datemax" name="endDate" class="input-text Wdate">
                      		</td>
                      	</tr>
                      </table>
                    </td>
                    <td></td>
                    <td style="text-align: left;">
                    	<button type="submit" class="btn btn-success radius" id="" name="" onclick="layer.load(1);" ><i class="Hui-iconfont">&#xe665;</i> 查询</button>
                    </td>
                </tr>
            </table>
        </div>
    </form>
    <div class="cl pd-5 bg-1 bk-gray mt-20"></span> <span class="r">共有数据：<strong>${pagination.totalCount?c}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg" style="margin-top: -1px;">
        <thead>
        <tr class="text-c">
            <th width="40">会员卡号</th>
            <th width="150">接口名称</th>
            <th width="90">发送时间</th>
            <th width="150">返回时间</th>
            <th width="90">状态</th>
            <th width="90">操作</th>
        </tr>
        </thead>
        <tbody>
        <#list pagination.list as cbdlog>
            <tr class="text-c">
                <td>${cbdlog.memberNo}  </td>
                <td>${cbdlog.interfaceName}</td>
                <td><#if cbdlog.sendDate??> ${cbdlog.sendDate?datetime} </#if></td>
                <td> <#if cbdlog.cbdReturnLog.returnDate?? >${cbdlog.cbdReturnLog.returnDate?datetime} </#if></td>
                <td>
                    <#if cbdlog.cbdReturnLog.returnCode == '1'>
                        <p style="color: #42b142">成功</p>
                    </#if>
                    <#if cbdlog.cbdReturnLog.returnCode == '0'>
                        <p style="color: red">失败</p>
                    </#if>
                </td>
                <td>
                
                <input type="hidden" value='${cbdlog.cbdReturnLog.returnParam}' id="returnParamJson${cbdlog_index}"  >
                <input type="hidden" value='${cbdlog.sendParam}' id="sendParamJson${cbdlog_index}"  >
                   <a title="详情" href="javascript:;" onclick="dio_result(${cbdlog_index})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe665;</i></a>
                </td>
            </tr>
        </#list>
        </tbody>
    </table>
    <div id="cbd_log_page" style="padding-top: 10px;float: right"></div>
</div>
<@frame.end "default">
</@frame.end>
</body>
</html>
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript">
    laypage({
            cont: 'cbd_log_page',//容器。值支持id名、原生dom对象，jquery对象。
            pages: ${pagination.totalPage},//通过后台拿到的总页数
            curr:  ${pagination.pageNo} || 1, //当前页
            skip: true, //是否开启跳页
        	first: 1, //将首页显示为数字1,。若不显示，设置false即可
        	last: ${pagination.totalPage}, //将尾页显示为总页数。若不显示，设置false即可
        jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
            $(pageNo).val(obj.curr);
            $(query_cbd_log_form).submit();
        }
    }
    })

    /*
     参数解释：
     title	标题
     url		请求的url
     id		需要操作的数据id
     w		弹出层宽度（缺省调默认值）
     h		弹出层高度（缺省调默认值）
     */
    /*管理员-增加*/
    function admin_add(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*管理员-删除*/
    function admin_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '',
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }

    /*管理员-编辑*/
    function admin_edit(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    /*管理员-停用*/
    function admin_stop(obj,id){
        layer.confirm('确认要停用吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……

            $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_start(this,id)" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">已禁用</span>');
            $(obj).remove();
            layer.msg('已停用!',{icon: 5,time:1000});
        });
    }

    /*管理员-启用*/
    function admin_start(obj,id){
        layer.confirm('确认要启用吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……


            $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_stop(this,id)" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
            $(obj).remove();
            layer.msg('已启用!', {icon: 6,time:1000});
        });
    }
 function dio_result(id){
	var jsonsendMsg= $("#sendParamJson"+id).val();
	var jsonreturnMsg= $("#returnParamJson"+id).val();
		layer.open({
  		  title: '信息',
  		  maxWidth:600,
  		  maxHeight:400,
  		  btn: [],
  		  area: [(document.body.clientWidth > 850 ? 850 : document.body.clientWidth) + "px", (document.body.clientHeight > 750 ? 710 : document.body.clientHeight - 40) + "px"],
  		  content: '<div> <b>发送信息:</b>'+jsonsendMsg+' <br /><br /> <b>返回信息:</b>'  +jsonreturnMsg +  '</div>'
  		});    
 }    
 
 
</script>